﻿/*
**主营业务申请页面
*/
Chenxin.UI.OtherBusinessApplyPage = Chenxin.extend(Chenxin.UI.AddPageCommon, {
    actionUrl: "/service/logic/OtherBusinessApply.ashx",
    createForm: function() {
        return new Chenxin.UI.OtherBusinessApplyForm({
            scope: this
        });
    },
    customerInit: function() {
    },
    initEvent: function() {
        var objPg = this;
        /*************事件：提交*************/
        $("#aSubmit").click(function() {
            if (objPg.form.ApplyInfo != undefined) {
                objPg.form.op = "upd";
            }
            objPg.form.save();
        });
        /*************事件：关闭*************/
        $("#aClose").click(function() {
            window.close();
        });
    }
});

/*
**主营业务申请窗体
*/
Chenxin.UI.OtherBusinessApplyForm = Chenxin.extend(Chenxin.UI.AddFormCommon, {
    actionUrl: "/service/logic/OtherBusinessApply.ashx",
    id: "divOtherBusiness",
    createComboList: function() {
        //获取初始Combo的值
        var jsonInitVal = this.initComboVal();

        //合同归属（城市）
        var comboBargainCityId = new Chenxin.UI.StructCombo({
            param: { op: 'getcity' },
            containerId: '#BargainCityId',
            name: 'BargainCityId',
            tbxWidth: 120,
            inModelType: 'all',
            txtModelName: 'BargainCityName',
            initValue: jsonInitVal.BargainCityId,
            onSelected: function() {
                if (this.getValue() == this.defVal) {
                    comboBargainCompanyId.clearItems();
                } else {
                    comboBargainCompanyId.param.fatherid = this.getValue();
                    comboBargainCompanyId.reload();
                }                
            },
            afterSetValue: function(newVal, oldVal) {
                if (newVal != this.defVal) {
                    comboBargainCompanyId.param.fatherid = newVal;
                    comboBargainCompanyId.reload(jsonInitVal.BargainCompanyId);
                }
            }
        });
        //合同归属（公司）
        var comboBargainCompanyId = new Chenxin.UI.StructCombo({
            param: { op: 'getcompany' },
            containerId: '#BargainCompanyId',
            name: 'BargainCompanyId',
            inModelType: 'all',
            txtModelName: 'BargainCompanyName',
            tbxWidth: 120,
            autoLoad: false,
            required: true
        });

        //业务门店（城市）
        var comboBuyerCityId = new Chenxin.UI.StructCombo({
            param: { op: 'getcity' },
            containerId: '#BuyerCityId',
            name: 'BuyerCityId',
            tbxWidth: 120,
            inModelType: 'all',
            txtModelName: 'BuyerCityName',
            initValue: jsonInitVal.BuyerCityId,
            onSelected: function() {
                if (this.getValue() == this.defVal) {
                    comboBuyerCompanyId.clearItems();
                } else {
                    comboBuyerCompanyId.param.fatherid = this.getValue();
                    comboBuyerCompanyId.reload();
                }
                comboBuyerDepartId.clearItems();
            }
        });

        //业务门店（公司）
        var comboBuyerCompanyId = new Chenxin.UI.StructCombo({
            param: { op: 'getcompany' },
            containerId: '#BuyerCompanyId',
            name: 'BuyerCompanyId',
            inModelType: 'all',
            txtModelName: 'BuyerCompanyName',
            tbxWidth: 120,
            autoLoad: false,
            required: true,
            onSelected: function() {
                if (this.getValue() == this.defVal) {
                    comboBuyerDepartId.clearItems();
                } else {
                    comboBuyerDepartId.param.fatherid = this.getValue();
                    comboBuyerDepartId.reload();
                }
            }
        });

        //业务门店（部门）
        var comboBuyerDepartId = new Chenxin.UI.StructCombo({
            param: { op: 'getcompanydeparts' },
            containerId: '#BuyerDepartId',
            name: 'BuyerDepartId',
            inModelType: 'all',
            txtModelName: 'BuyerDepartName',
            tbxWidth: 120,
            colWidth: 120,
            autoLoad: false,
            required: true,
            hasPage: true,
            hasSearch: true,
            onSelected: function() {
                if (this.getValue() != this.defVal) {
                    comboBuyerUserId.loadUser(this.getValue());
                }
            }
        });

        //下家业务员
        var comboBuyerUserId = new Chenxin.UI.RichModelTreeCombo({
            containerId: '#txtBuyerUserId',
            textBoxId: 'txtBuyerUserId',
            inModelType: 'all',
            txtModelName: 'BuyerUserName',
            required: true,
            singleSelect: true,
            name: 'BuyerUserId'
        });
        return [comboBargainCityId, comboBargainCompanyId, comboBuyerCityId, comboBuyerCompanyId, comboBuyerDepartId, comboBuyerUserId];
    },
    initFormValidator: function() {

        //客户姓名
        $("#txtBuyerName").formValidator({
            validatorgroup: this.id,
            onshow: "请输入客户姓名！",
            onfocus: "客户姓名为必输项",
            oncorrect: " "
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "客户姓名不能为空！"
            },
            onerror: "客户姓名不能为空！"
        });
        //身份证
        $("#txtBuyerNo").formValidator({
            validatorgroup: this.id,
            onshow: "请输入身份证号！",
            onfocus: "身份证号为必输项",
            oncorrect: " "
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "身份证号不能为空！"
            },
            onerror: "身份证号不能为空！"
        }).functionValidator({
            fun: function(val, elem) {
                return val.isIdCardNo();
            },
            onerror: "身份证格式不正确！"
        });
        //手机
        $("#txtBuyerMobile").formValidator({
            validatorgroup: this.id,
            onshow: "请输入手机号！",
            onfocus: "手机号为必输项",
            oncorrect: " "
        }).inputValidator({
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "手机号不能为空！"
            },
            onerror: "手机号不能为空！"
        }).functionValidator({
            fun: function(val, elem) {
                return val.isMobile();
            },
            onerror: "手机格式不正确！"
        });
        //上家确认佣收
        $("#txtVRealCommision").formValidator({
            validatorgroup: this.id,
            onshow: "请输入上家确认佣收！",
            onfocus: "上家确认佣收为金额格式",
            oncorrect: " "
        }).functionValidator({
            fun: function(val, elem) {
                return val.isNum();
            },
            onerror: "非金额格式！"
        });
        //上家事前折佣
        $("#txtVCommision").formValidator({
            validatorgroup: this.id,
            onshow: "请输入上家事前折佣！",
            onfocus: "上家事前折佣为金额格式",
            oncorrect: " "
        }).functionValidator({
            fun: function(val, elem) {
                return val.isNum();
            },
            onerror: "非金额格式！"
        });
        //上家咨询费
        $("#txtVConsulting").formValidator({
            validatorgroup: this.id,
            onshow: "请输入上家咨询费！",
            onfocus: "上家咨询费为金额格式",
            oncorrect: " "
        }).functionValidator({
            fun: function(val, elem) {
                return val.isNum();
            },
            onerror: "非金额格式！"
        });
        //下家确认佣收
        $("#txtBRealCommision").formValidator({
            validatorgroup: this.id,
            onshow: "请输入下家确认佣收！",
            onfocus: "下家确认佣收为金额格式",
            oncorrect: " "
        }).functionValidator({
            fun: function(val, elem) {
                return val.isNum();
            },
            onerror: "非金额格式！"
        });
        //下家事前折佣
        $("#txtBCommision").formValidator({
            validatorgroup: this.id,
            onshow: "请输入下家事前折佣！",
            onfocus: "下家事前折佣为金额格式",
            oncorrect: " "
        }).functionValidator({
            fun: function(val, elem) {
                return val.isNum();
            },
            onerror: "非金额格式！"
        });
        //下家咨询费
        $("#txtBConsulting").formValidator({
            validatorgroup: this.id,
            onshow: "请输入下家咨询费！",
            onfocus: "下家咨询费为金额格式",
            oncorrect: " "
        }).functionValidator({
            fun: function(val, elem) {
                return val.isNum();
            },
            onerror: "非金额格式！"
        });
    },
    manualPreCheck: function() {

        var bRet = true;
        var RowCnt = 0;
        var isValidOfOther = true;
        //业绩申请-点数分配情况
        $("#tbPointInfo tr").each(function() {

            //数据领域
            if ($(this).find("input[name='DepartId']").length > 0) {
                //门店
                var objDepart = $(this).find("input[name=DepartId]:eq(0)");
                if (objDepart.val() == "") {
                    alert("请输入门店");
                    objDepart.focus();
                    bRet = false;
                    isValidOfOther = false;
                    return false;
                }
                //业务员
                var objUser = $(this).find("input[name=EmployeeId]:eq(0)");
                if (objUser.val() == "") {
                    alert("请输入业务员");
                    objUser.focus();
                    bRet = false;
                    isValidOfOther = false;
                    return false;
                }
                //点数
                var objPoint = $(this).find("input[name=Point]:eq(0)");
                if (objPoint.val() == "") {
                    alert("请输入点数");
                    objPoint.focus();
                    bRet = false;
                    isValidOfOther = false;
                    return false;
                }
                //数值
                if (objPoint.val().isNum() == false) {
                    alert("请输入数值");
                    objPoint.focus();
                    bRet = false;
                    isValidOfOther = false;
                    return false;
                } else {
                    RowCnt = RowCnt + parseFloat(objPoint.val());
                }
            }
        });
        //无点数分配信息
        if (RowCnt != 10 && isValidOfOther) {
            alert("点数分配不正确");
            bRet = false;
        }
        return bRet;
    },
    initEvent: function() {
        var objFrm = this;
        /*******************事件：添加点数分配******************/
        $("#aAddPointInfo").click(function() {
            objFrm.createTr(true);
        });
        /*****************事件：删除点数分配信息****************/
        $("A[name='aDelPointInfo']").live("click", function() {
            //行位置
            var trIndex = $(this).parents("tbody:first").children("tr").index($(this).parents("tr:first"));

            if ($(this).parents("tbody:first").children("tr").length == 3) {
                alert("点数分配为必要信息,不可全删除");
            } else {
                if (confirm("确定要删除吗？")) {
                    var objOwerTr = $(this).parents("tr:first");
                    $(objOwerTr).remove();
                    objFrm.lsObjPoint.splice(trIndex, 1);
                    objFrm.lsComboPointInfo.splice(trIndex, 1);
                }
            }
        });
    },
    createTrComboList: function(idxRow, PointInfo) {
        //客户类型
        var strCreate = "";
        strCreate = strCreate + "var comboBuyerOrVenderInfo_" + idxRow.toString().padLeft(2, "0") + " = new Chenxin.UI.Combo({";
        strCreate = strCreate + "   containerId: '#BuyerOrVenderInfo_" + idxRow.toString().padLeft(2, "0") + "',";
        strCreate = strCreate + "   name: 'BuyerOrVenderInfo',";
        strCreate = strCreate + "   addPleaseSelected:false,";
        strCreate = strCreate + "   tbxWidth: 40,";
        if (PointInfo != undefined) {
            strCreate = strCreate + "   initValue:'" + PointInfo.BuyerOrVenderInfo + "',";
        }
        strCreate = strCreate + "   items:comboCommon.DealPerson";
        strCreate = strCreate + "});";

        //业务员
        strCreate = strCreate + "var comboEmployeeId_" + idxRow.toString().padLeft(2, "0") + " = new Chenxin.UI.RichModelTreeCombo({";
        strCreate = strCreate + "    textBoxId:'txtEmployeeId_" + idxRow.toString().padLeft(2, "0") + "',";
        strCreate = strCreate + "    inModelType:'all',";
        strCreate = strCreate + "	 txtModelName:'Employee',";
        strCreate = strCreate + "    singleSelect:true,";
        strCreate = strCreate + "    name:'EmployeeId'";
        strCreate = strCreate + "});";

        //店长
        strCreate = strCreate + "var comboDeparterManagerId_" + idxRow.toString().padLeft(2, "0") + " = new Chenxin.UI.RichModelTreeCombo({";
        strCreate = strCreate + "    textBoxId:'txtDeparterManagerId_" + idxRow.toString().padLeft(2, "0") + "',";
        strCreate = strCreate + "    inModelType:'all',";
        strCreate = strCreate + "	 txtModelName:'DeparterManagerName',";
        strCreate = strCreate + "    singleSelect:true,";
        strCreate = strCreate + "    name:'DeparterManagerId'";
        strCreate = strCreate + "});";

        //高经
        strCreate = strCreate + "var comboMangerId_" + idxRow.toString().padLeft(2, "0") + " = new Chenxin.UI.RichModelTreeCombo({";
        strCreate = strCreate + "    textBoxId:'txtMangerId_" + idxRow.toString().padLeft(2, "0") + "',";
        strCreate = strCreate + "    inModelType:'all',";
        strCreate = strCreate + "	 txtModelName:'MangerName',";
        strCreate = strCreate + "    singleSelect:true,";
        strCreate = strCreate + "    name:'MangerId'";
        strCreate = strCreate + "});";

        //区经
        strCreate = strCreate + "var comboRegionMangerId_" + idxRow.toString().padLeft(2, "0") + " = new Chenxin.UI.RichModelTreeCombo({";
        strCreate = strCreate + "    textBoxId:'txtRegionMangerId_" + idxRow.toString().padLeft(2, "0") + "',";
        strCreate = strCreate + "    inModelType:'all',";
        strCreate = strCreate + "	 txtModelName:'RegionManagerName',";
        strCreate = strCreate + "    singleSelect:true,";
        strCreate = strCreate + "    name:'RegionManagerId'";
        strCreate = strCreate + "});";

        //总监
        strCreate = strCreate + "var comboMajordomoId_" + idxRow.toString().padLeft(2, "0") + " = new Chenxin.UI.RichModelTreeCombo({";
        strCreate = strCreate + "    textBoxId:'txtMajordomoId_" + idxRow.toString().padLeft(2, "0") + "',";
        strCreate = strCreate + "    inModelType:'all',";
        strCreate = strCreate + "	 txtModelName:'MajordomoName',";
        strCreate = strCreate + "    singleSelect:true,";
        strCreate = strCreate + "    name:'MajordomoId'";
        strCreate = strCreate + "});";

        //门店
        strCreate = strCreate + "var comboDepartId_" + idxRow.toString().padLeft(2, "0") + " = new Chenxin.UI.DepartTreeCombo({";
        strCreate = strCreate + "   textBoxId: 'txtDepartId_" + idxRow.toString().padLeft(2, "0") + "',";
        strCreate = strCreate + "   name: 'DepartId',";
        strCreate = strCreate + "   inModelType:'all',";
        strCreate = strCreate + "   txtModelName:'Depart',";
        strCreate = strCreate + "   onSelected:function(node,el){";

        strCreate = strCreate + "       if (!node.select) {";
        strCreate = strCreate + "   		comboEmployeeId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		comboDeparterManagerId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		comboMangerId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		comboRegionMangerId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		comboMajordomoId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		return false;";
        strCreate = strCreate + "       }";

        strCreate = strCreate + "   	if( this.getValue() != this.defVal ){";
        strCreate = strCreate + "   		comboEmployeeId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		comboDeparterManagerId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		comboMangerId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		comboRegionMangerId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        strCreate = strCreate + "   		comboMajordomoId_" + idxRow.toString().padLeft(2, "0") + ".reset();";
        //strCreate = strCreate + "debugger;" + "\n";
        strCreate = strCreate + "           Chenxin.ajax({";
        strCreate = strCreate + "               url: '/service/logic/MainBusinessApply.ashx',";
        strCreate = strCreate + "               data: {DepartId:this.getValue(),op:'getparents'},";
        strCreate = strCreate + "               type: 'get',";
        strCreate = strCreate + "               dataType: 'json',";
        strCreate = strCreate + "               async: false,";
        strCreate = strCreate + "               onSuccess: function(data, msg) {";

        //店长
        strCreate = strCreate + "                   if (data.DeparterManagerId != undefined){";
        strCreate = strCreate + "                       comboDeparterManagerId_" + idxRow.toString().padLeft(2, "0") + ".setValue(data.DeparterManagerId)";
        strCreate = strCreate + "                   }";
        //高经
        strCreate = strCreate + "                   if (data.MangerId != undefined){";
        strCreate = strCreate + "                       comboMangerId_" + idxRow.toString().padLeft(2, "0") + ".setValue(data.MangerId)";
        strCreate = strCreate + "                   }";
        //区经
        strCreate = strCreate + "                   if (data.RegionMangerId != undefined){";
        strCreate = strCreate + "                       comboRegionMangerId_" + idxRow.toString().padLeft(2, "0") + ".setValue(data.RegionMangerId)";
        strCreate = strCreate + "                   }";
        //总监
        strCreate = strCreate + "                   if (data.MajordomoId != undefined){";
        strCreate = strCreate + "                       comboMajordomoId_" + idxRow.toString().padLeft(2, "0") + ".setValue(data.MajordomoId)";
        strCreate = strCreate + "                   }";

        strCreate = strCreate + "               }";
        strCreate = strCreate + "           });";

        strCreate = strCreate + "   		comboEmployeeId_" + idxRow.toString().padLeft(2, "0") + ".loadUser(this.getValue());";
        strCreate = strCreate + "   		comboDeparterManagerId_" + idxRow.toString().padLeft(2, "0") + ".loadUser(this.getValue());";
        strCreate = strCreate + "   		comboMangerId_" + idxRow.toString().padLeft(2, "0") + ".loadUser(this.getValue());";
        strCreate = strCreate + "   	}";
        strCreate = strCreate + "   }";
        strCreate = strCreate + "});";

        eval(strCreate);

        if (this.lsComboPointInfo == undefined) {
            this.lsComboPointInfo = [];
        }
        var trCombo = [];
        trCombo.push(eval("comboBuyerOrVenderInfo_" + idxRow.toString().padLeft(2, "0")));
        trCombo.push(eval("comboEmployeeId_" + idxRow.toString().padLeft(2, "0")));
        trCombo.push(eval("comboDeparterManagerId_" + idxRow.toString().padLeft(2, "0")));
        trCombo.push(eval("comboMangerId_" + idxRow.toString().padLeft(2, "0")));
        trCombo.push(eval("comboRegionMangerId_" + idxRow.toString().padLeft(2, "0")));
        trCombo.push(eval("comboMajordomoId_" + idxRow.toString().padLeft(2, "0")));
        trCombo.push(eval("comboDepartId_" + idxRow.toString().padLeft(2, "0")));

        //初始设定
        if (PointInfo != undefined) {
            for (var idxCnt = 1; idxCnt < trCombo.length; idxCnt++) {
                if (PointInfo[trCombo[idxCnt].name] != "00000000-0000-0000-0000-000000000000") {
                    trCombo[idxCnt].setValue(PointInfo[trCombo[idxCnt].name]);
                }
            }
            //业务员
            trCombo[1].loadUser(PointInfo[trCombo[6].name]);
            //店长
            trCombo[2].loadUser(PointInfo[trCombo[6].name]);
            //高经
            trCombo[3].loadUser(PointInfo[trCombo[6].name]);
        }

        this.lsComboPointInfo.push(trCombo);
    },
    createTr: function(bFocus, PointInfo) {
        //当前点数分配行数
        if (this.MaxPointInfo == undefined) {
            this.MaxPointInfo = 0;
        }
        var curRowCnt = this.MaxPointInfo;
        //最后一个行
        objLastTr = $("#tbPointInfo").find("tr:last").prev();

        //点数
        var Point = "";
        if (PointInfo != undefined) {
            Point = PointInfo.Point;
        }

        //点数分配行信息
        var htmlTr = "";
        htmlTr = htmlTr + "<tr id='trPointInfo_" + curRowCnt.toString().padLeft(2, "0") + "'>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <div id='BuyerOrVenderInfo_" + curRowCnt.toString().padLeft(2, "0") + "' style='z-index:" + (100 - curRowCnt).toString() + "; margin-right: 2px;' class='SelectWrapSingle'></div>";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <input type=text id='txtDepartId_" + curRowCnt.toString().padLeft(2, "0") + "' name='DepartId' class='inputbox_n fl' style='width:60px' />";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <input type=text id='txtEmployeeId_" + curRowCnt.toString().padLeft(2, "0") + "' name='EmployeeId' class='inputbox_n fl' style='width:60px' />";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <input type=text id='txtDeparterManagerId_" + curRowCnt.toString().padLeft(2, "0") + "' name='DeparterManagerId' class='inputbox_n fl' style='width:60px' />";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <input type=text id='txtMangerId_" + curRowCnt.toString().padLeft(2, "0") + "' name='MangerId' class='inputbox_n fl' style='width:60px' />";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <input type=text id='txtRegionMangerId_" + curRowCnt.toString().padLeft(2, "0") + "' name='RegionManagerId' class='inputbox_n fl' style='width:60px' />";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <input type=text id='txtMajordomoId_" + curRowCnt.toString().padLeft(2, "0") + "' name='MajordomoId' class='inputbox_n fl' style='width:60px' />";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <input type=text id='txtPoint_" + curRowCnt.toString().padLeft(2, "0") + "' name='Point' class='inputbox_n fl' style='width:60px' value='" + Point + "' />";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "    <td>";
        htmlTr = htmlTr + "        <a href='javascript:void(0)' name='aDelPointInfo'>删除</a>";
        htmlTr = htmlTr + "    </td>";
        htmlTr = htmlTr + "</tr>";
        //添加行数据
        $(objLastTr).before(htmlTr);

        if (PointInfo == undefined) {
            //生成下拉框
            this.createTrComboList(curRowCnt);
            //聚焦
            if (bFocus == true) {
                $(objLastTr).prev().find("input:eq(0)").focus();
            }
        } else {
            //生成下拉框
            this.createTrComboList(curRowCnt, PointInfo);
        }

        if (this.lsObjPoint == undefined) {
            this.lsObjPoint = [];
        }
        this.lsObjPoint.push("#txtPoint_" + curRowCnt.toString().padLeft(2, "0"));
        this.MaxPointInfo = this.MaxPointInfo + 1;
    },
    saveSucc: function() {
        //提交成功后转到查询页面
        window.location.href = "/page/Contract_ApplyInfo/ShowListContractApply.aspx";
    },
    afterGetFormJson: function(json) {

        json.PointRemark = $("#txtaPointRemark").val();

        var JsonList = [];
        var trJson = {};
        this.form.additionalParam = {};

        //点数分配情况
        var ModelType;
        for (var idxCntOfPoint = 0; idxCntOfPoint < this.form.lsObjPoint.length; idxCntOfPoint++) {
            trJson = {};
            for (var idxCntOfCombo = 0; idxCntOfCombo < this.form.lsComboPointInfo[idxCntOfPoint].length; idxCntOfCombo++) {
                ModelType = this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].inModelType;
                if (ModelType == "txt") {
                    if (this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getValue() != undefined &&
                        this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getValue() != "") {
                        trJson[this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].name] =
                               this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getText();
                    }
                } else if (ModelType == "val") {
                    if (this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getValue() != undefined &&
                    this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getValue() != "") {
                        trJson[this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].name] =
                               this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getValue();
                    }
                }
                else {
                    if (this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getValue() != undefined &&
                        this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getValue() != "") {
                        trJson[this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].name] =
                                this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getValue();
                        trJson[this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].txtModelName] =
			                    this.form.lsComboPointInfo[idxCntOfPoint][idxCntOfCombo].getText();
                    }
                }
            }
            trJson["Point"] = $(this.form.lsObjPoint[idxCntOfPoint]).val();
            JsonList.push(trJson);
        }
        //客户端点数分配信息
        if (JsonList.toString() != "") {
            this.form.additionalParam.PointInfo = "[" + JsonList.toString() + "]";
        }
    },
    initForm: function() {

        //初始业绩申请信息
        if ($("#ctl00_main_hidApplyInfo").val() != "") {
            var applyInfo = eval("(" + $("#ctl00_main_hidApplyInfo").val() + ")");
            //有房源信息
            this.ApplyInfo = applyInfo;
        }
        //点数分配信息
        if ($("#ctl00_main_hidPointInfo").val() != "") {
            var pointInfo = eval("(" + $("#ctl00_main_hidPointInfo").val() + ")");
            //点数分配信息
            this.PointInfo = pointInfo;
        }
        //初始化人员信息
        if ($("#ctl00_main_hidUserInfo").val() != "") {
            var userInfo = eval("(" + $("#ctl00_main_hidUserInfo").val() + ")");
            //点数分配信息
            this.UserInfo = userInfo;
        }
    },
    initComboVal: function() {
    var jsonInitVal = {};
    jsonInitVal.BargainCityId = this.UserInfo.CityId;
    jsonInitVal.BargainCompanyId = this.UserInfo.CompanyId;
        if (this.ApplyInfo != undefined) {
            jsonInitVal.BargainCityId = this.ApplyInfo.BargainCityId;
            //jsonInitVal.BargainCompanyId = this.ApplyInfo.BargainCompanyId;

            jsonInitVal.BuyerCityId = this.ApplyInfo.BuyerCityId;
            //jsonInitVal.BuyerCompanyId = this.ApplyInfo.BuyerCompanyId;
            //jsonInitVal.BuyerDepartId = this.ApplyInfo.BuyerDepartId;
            //jsonInitVal.BuyerUserId = this.ApplyInfo.BuyerUserId;
        }
        return jsonInitVal;
    },
    loadDefVal: function() {
        //业绩申请信息
        if (this.ApplyInfo != undefined) {

            this.comboList[1].param.fatherid = this.ApplyInfo.BargainCityId;
            this.comboList[1].reload(this.ApplyInfo.BargainCompanyId);

            this.comboList[3].param.fatherid = this.ApplyInfo.BuyerCityId;
            this.comboList[3].reload(this.ApplyInfo.BargainCompanyId);
            this.comboList[4].param.fatherid = this.ApplyInfo.BargainCompanyId;
            this.comboList[4].reload(this.ApplyInfo.BuyerDepartId);

            this.comboList[5].setValue(this.ApplyInfo.BuyerUserId);
            //绑定申请业绩部分
            Chenxin.Fn.setFormValue(this.id, {}, this.ApplyInfo);
            //点数分配备注
            $("#txtaPointRemark").val(this.ApplyInfo.PointRemark);
        }
        //无点数分配信息
        if (this.PointInfo == undefined) {
            this.createTr(false);
        } else {
            for (var idxCnt = 0; idxCnt < this.PointInfo.length; idxCnt++) {
                this.createTr(false, this.PointInfo[idxCnt]);
            }
        }
    }
});

$(document).ready(function() {
    var objPage = new Chenxin.UI.OtherBusinessApplyPage();
});